import request from '@/utils/request'

/*
 *   获取 组织架构的数据
 */
export function getDepartments() {
  // request执行一个方法,返回一个promise对象
  return request({
    url: '/company/department'
  })
}

/*
 *   删除 组织架构的数据
 */
export function delDepartments(id) {
  return request({
    method: 'delete',
    url: `/company/department/${id}`
  })
}
/*
 *   新增 组织架构的数据
 */
export function addDepartments(data) {
  return request({
    method: 'POST',
    url: '/company/department', //  restful 接口规范
    data
  })
}

/*
 *   获取 某个组织架构的详细数据
 */
export function getDeparDetail(id) {
  return request({
    url: `/company/department/${id}`
  })
}
/*
 *   根据ID修改部门详情
 */
export function leditepartments(data) {
  return request({
    method: 'PUT',
    url: `/company/department/${data.id}`,
    data
  })
}
